package cn.yunyichina.openapi.web.controller;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

public class BaseController {

	public void writetoPage(HttpServletResponse response, String s) {
		try {
			response.setContentType("application/json");
			response.setCharacterEncoding("UTF-8");
			response.setHeader("Access-Control-Allow-Origin", "*");		//若网站和接口分开需如此允许跨域
			PrintWriter out = response.getWriter();
			out.print(s);
			out.flush();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
